package org.mudamage.mud8.client.mud.static_data.equip;


public class EquipEquip {
	/*
	 * 説明 
	 * 0:基本情報 [名前,装備可能職,攻撃速度]
	 * 1:防御力情報 [兜,EX兜,鎧,EX鎧,手,EX手,腰,EX腰,足,EX足]
	 * 2:要求力 if long [(上昇数値,ベース数値,EXベース数値)...] short [上昇数値,(ベース数値,EXベース数値)...]
	 * (3:要求敏)
	 * (4:要求エナ)
	 */
	private static double[][][] data ={
		{{1,25,8},{5,20,10,28,2,12,7,22,2,11},{720,34.4,94.4,44,104,29.6,89.6,39.2,99.2,32,92}},
		{{1,25,4},{9,22,14,30,4,13,10,25,4,14},{720,58.4,118.4,63.2,123.2,51.2,111.2,56,116,48.8,108.8},{180,29.6,44.6,30.8,45.8,27.8,42.8,29,44,27.2,42.2}},
		{{0,25,10},{12,26,18,34,7,18,14,29,8,20},{990,105.8,188.3,990,112.4,194.9,990,92.6,175.1,990,102.5,185,991,92.54,175}},
		{{5,9,8},{17,33,22,39,9,22,18,35,10,23},{900,128,203,134,209,116,191,125,200,116,191},{270,52.4,74.9,54.2,76.7,48.8,71.3,51.5,74,48.8,71.3}},
		{{1,9,4},{20,38,30,50,12,27,22,40,12,27},{1170,199.4,296.9,207.2,304.7,183.8,281.3,195.5,293,183.8,281.3}},
		{{0,9,6},{24,44,37,59,14,31,26,46,15,32},{1080,225.2,315.2,232.4,322.4,207.2,297.2,218,308,214.4,304.4},{270,71.3,93.8,73.1,95.6,66.8,89.3,69.5,92,68.6,91.1}},
		{{0,1,6},{27,48,42,67,18,37,33,55,19,39},{1440,341.6,461.6,380,500,312.8,432.8,351.2,471.2,346.4,466.4},{450,120.5,158,132.5,170,111.5,149,123.5,161,122,159.5}},
		{{0,1,6},{30,54,48,76,22,44,40,65,24,46},{1529,438.26,565.81,479.1,606.55,407.68,535.13,448.52,575.97,417.84,545.39},{540,167.6,212.6,182,227,156.8,201.8,171.2,216.2,160.4,205.4}},
		{{1,1,6},{43,70,63,94,37,63,54,83,40,67},{1843,585.85,739.7,1923,662.24,822.7,1843,548.99,702.84,1861,616.29,771.51,1781,572.38,720.95},{558,191.1,237.62,582,215.16,263.98,564,182.6,229.96,564,201.6,248.96,540,187.4,232.4}},
		{{0,1,6},{53,83,75,111,48,76,65,97,50,79},{1800,644,794,776,926,584,734,698,848,608,758},{521,200.95,244.53,239.32,282.74,183.58,227.11,216.69,260.16,190.53,234.11}},
		{{0,1,7},{66,102,88,127,60,92,78,114,63,96},{1529,683.1,810.55,734.1,861.55,601.52,728.97,703.52,830.97,626.97,754.52},{540,254,299,272,317,225.2,270.2,261.2,306.2,234.2,279.2}},
		{{1,10,0},{4,18,7,21,2,14,5,17,3,16},{180,23,38,270,29,51.5,180,21.8,36.8,270,27.2,49.7,180,22.4,37.4}},
		{{1,10,0},{9,22,13,28,5,15,10,24,6,17},{270,36.2,58.7,360,46.4,76.4,180,28.4,43.4,360,44,74,270,34.4,56.9}},
		{{9,10,0},{13,27,17,33,8,20,15,30,9,22},{270,48.8,71.3,360,65.6,95.6,180,36.8,51.8,360,60.8,90.8,270,47,69.5}},
		{{1,10,0},{18,36,22,41,11,26,20,38,12,28},{270,65,87.5,360,87.2,117.2,180,46.4,61.4,360,83.6,113.6,270,61.4,83.9}},
		{{0,2,6},{22,42,27,50,15,33,25,46,17,37},{476,126.64,166.24,139.24,179,116.96,156.72,129.72,169.48,128.16,167.92},{107,44.23,53.23,47,56,41.93,50.93,44.86,53.86,44.51,53.51}},
		{{1,2,5},{27,51,33,59,20,41,30,55,22,44},{531,163.28,207.59,531,181.07,225.28,441,122.9,159.59,530,172.3,216.5,530,154.6,198.8},{180,68.6,83.6,180,74.6,89.6,90,41,48.5,180,71.6,86.6,90,42.8,50.3}},
		{{0,2,6},{36,65,43,75,30,55,39,70,31,57},{492,201.8,242.96,221.48,262.88,163.88,204.96,213.08,254.48,176.96,218},{161,79.39,92.95,85.9,99.39,66.95,80.51,83.29,96.73,71.34,84.9}},
		{{0,2,7},{48,81,57,94,44,74,55,90,47,80},{392,186.64,219.64,212.96,245.96,166.96,199.96,198.4,231.4,177.16,210.16},{134,76.66,87.98,85.66,96.98,69.98,81.28,80.66,92,73.62,84.92}},
		{{1,4,4},{4,17,8,23,2,12,6,20,2,11},{270,25.4,47.9,29,51.5,23.6,46.1,27.2,49.7,24.5,47},{540,30.8,75.8,38,83,27.2,72.2,34.4,79.4,29,74}},
		{{1,4,8},{8,21,12,27,4,13,10,23,4,14},{270,34.4,56.9,38,60.5,32.6,55.1,36.2,58.7,33.5,56},{629,53.68,106.13,62.1,114.55,49.52,101.97,57.84,110.39,51.55,104.1}},
		{{1,4,10},{12,26,16,32,6,17,14,29,7,19},{270,45.2,67.7,48.8,71.3,43.4,65.9,47,69.5,44.3,66.8},{720,87.2,147.2,96.8,-1,82.4,142.4,92,152,84.8,144.8}},
		{{1,4,4},{16,32,21,38,9,22,18,35,10,25},{360,68,98,72.8,102.8,65.6,95.6,70.4,100.4,68,98},{720,116,176,125.6,185.6,111.2,171.2,120.8,180.8,116,176}},
		{{1,4,6},{23,42,29,50,15,32,25,44,16,34},{360,83.6,113.6,88.4,118.4,80,110,84.8,114.8,82.4,112.4},{720,147.2,207.2,156.8,216.8,140,200,149.6,209.6,144.8,204.8}},
		{{0,4,6},{30,52,36,60,22,42,32,54,23,44},{450,120.5,158,132.5,170,111.5,149,123.5,161,122,159.5},{630,160.7,213.2,177.5,230,148.1,200.6,164.9,217.4,162.8,215.3}},
		{{1,4,6},{37,63,44,71,29,51,39,65,30,54},{450,147.5,185,158,195.5,128,165.5,152,189.5,141.5,179},{990,300.5,383,323.6,406.1,257.6,-1,310.4,392.9,287.3,369.8}},
		{{0,4,6},{46,73,55,86,38,63,48,77,40,66},{464,165.32,204.32,190.32,229.32,151.32,190.32,176.32,215.32,155.96,194.96},{1034,340.94,427,396,482.32,309.92,396,365,451.3,320.26,406.32}},
		{{0,4,7},{57,91,68,106,50,81,61,97,53,85},{341,163.72,192.13,186.49,214.95,146.54,175.08,173.95,202.49,155.72,184.18},{720,322.4,-1,370.4,430.4,286.4,346.4,344,404,305.6,365.6}},
		{{3,8,6},{44,68,20,41,34,57,22,41},{1351,380,492.49,335,447.49,353,465.49,344,456.88},{629,188.1,240.55,167.1,219.55,175.52,227.97,171.26,223.81}},
		{{3,8,7},{52,82,27,52,41,68,29,55},{1392,508.4,624.8,443.24,559.64,489.96,605.96,475.96,591.96},{450,177.5,215,156.5,194,171.5,209,167,204.5}},
		{{4,8,7},{60,91,34,59,49,77,37,63},{1530,565.7,693.2,1350,416,528.5,1350,465.5,578,1350,434,546.5,},{630,244.7,297.2,204.8,257.3,227.9,280.4,213.2,265.7}},
		{{3,8,7},{73,108,45,74,61,95,50,81},{1458,642.04,763.52,515.68,637.2,612.84,734.42,554.52,676.1},{592,273.56,322.96,221.96,271.56,261.72,311.08,237.96,287.4}},
		{{4,8,7},{86,125,55,89,74,111,61,96},{1301,659.89,768,572.89,681,607,716,589.97,698.92},{540,284.6,329.6,248.6,293.6,263,308,255.8,300.8}},
		{{2,16,7},{20,38,25,45,12,27,21,40,13,29},{629,116.68,169.13,150.26,202.81,108.39,160.81,125.1,177.55,114.55,167.1},{180,47.6,62.6,57.2,72.2,45.2,60.2,50,65,47,62}},
		{{2,16,6},{24,45,36,60,18,36,26,48,20,40},{692,172.48,230.24,200.16,257.96,151.72,209.48,181.8,239.48,158.64,216.4},{189,61.55,77.33,69.11,84.88,55.88,71.66,64.1,79.77,57.77,73.55}},
		{{2,16,5},{26,50,43,71,21,43,31,57,25,48},{756,236.64,299.64,261.88,324.88,209,272,251.84,314.84,229.08,292.08},{200,76,93,83,99,69,-1,80,-1,74,91}},
		{{2,16,5},{30,56,47,77,25,50,35,63,29,55},{720,252.8,312.8,272,332,238.4,298.4,262.4,322.4,255.2,315.2},{188,81.2,96.84,86.2,101.96,77.44,93.08,83.6,99.44,81.72,97.48}},
		{{2,16,4},{34,63,51,83,29,53,39,69,33,60},{720,274.4,334.4,300.8,360.8,233.6,293.6,284,344,248,308},{188,86.84,102.48,93.72,109.48,76.08,91.84,89.32,105.08,79.84,95.6}},
		{{2,16,5},{46,80,64,102,40,65,52,88,44,74},{558,261.78,308.26,293.42,339.84,224.52,271.1,280.36,326.84,245.04,291.52},{143,82.42,94.42,90.57,102.57,72.85,84.85,87.27,99.27,78.13,90.13}},
		{{0,32,6},{13,27,22,39,9,21,16,32,11,25},{276,46.16,69.44,350,59.5,89,200,35,52,323,52.47,79.47,241,41.13,61.49}},
		{{0,32,8},{18,36,28,49,13,28,22,40,15,31},{231,59.28,78.59,315,78.8,105,161,43.78,57.29,315,75.65,101.85,223,54.7,73.47},{31,26.28,29.28,71,33.48,39.48,31,25.59,28.59,61,31.29,36.51,34,25.62,28.62}},
		{{0,32,7},{24,45,35,59,19,38,28,50,21,41},{464,126.32,165.32,464,137.32,176.32,464,115.32,154.32,440,125.8,162.6,476,123.4,163.16},{143,52.7,64.7,56,68,49.28,61.28,54.57,66.57,51.27,63.27}},
		{{0,32,6},{32,56,45,72,26,48,37,63,28,51},{540,165.8,210.8,540,183.8,228.8,450,125,162.5,540,174.8,219.8,540,156.8,201.8},{180,68.6,83.6,180,74.6,89.6,90,41,48.5,180,71.6,86.6,90,42.8,50.3}},
		{{0,32,0},{43,73,56,89,34,59,49,81,38,65},{510,204.5,246.5,512,228.68,271.4,500,166,208,512,220.04,262.8,513,182.44,225.09},{180,86,101,171,89.48,103.74,180,72.2,87.2,171,86.61,100.9,180,77,92}}
	};

	private static String[] series = {
		"革の","青銅の","スケイル","ミスリル","鋼鉄の","ドラゴン","アッシュクロー",
		"ブラックドラゴン","フェニックスの","グレートドラゴン","ドラゴンナイト",
		"魔導の","骸骨の","スフィンクスの","オーディーンの","イクリプス",
		"ルシファーの","ブラックソウル","ベノムミスト",
		"エルフの","シルクの","風の","精霊の","パルテナの","アイリス",
		"エウロパの","レッドスピリット","シルフィード",
		"ケルベロス","ヴァリアント","ハーデスの","アスリル","ボルケーノの",
		"ロード","ダークソウル","ダークブリザード","グロリアス","ダークマスター","ソレイユ",
		"サイクロン","レッドウイング","エンシェント","デモニック","ストームブリッツ"
	};
	/**
	 * 部位名を返します
	 * @param part
	 * @param type
	 * @return part_name
	 */
	private static String getPartName(int part,double type){
		/*
		 * 0:"ヘルム","アーマー","グラブ","ガーダー","ブーツ"
		 * 1:"兜","鎧","グラブ","ガーダー","靴"
		 * 2:"マスク","アーマー","グラブ","ガーダー","ブーツ"
		 * 3:"アーマー","グラブ","ガーダー","ブーツ"
		 * 4:"鎧","グラブ","ガーダー","ブーツ"
		 * 5:"の兜","アーマー","グラブ","ガーダー","ブーツ"
		 * 9:"仮面","鎧","グラブ","ガーダー","靴"
		 */
		if(part==0){// 兜
			if(type==0)
				return "ヘルム";
			else if(type==1)
				return "兜";
			else if(type==2)
				return "マスク";
			else if(type==5)
				return "の兜";
			else
				return "仮面";
		}else if(part==1){// 鎧
			if(type==0||type==2||type==5)
				return "アーマー";
			else
				return "鎧";
		}else if(part==2){// 手
			return "グラブ";
		}else if(part==3){// 腰
			return "ガーダー";
		}else{// 足
			if(type==0||type==2||type==5)
				return "ブーツ";
			else
				return "靴";
		}
	}
	private static Integer calcDef(int name,int plus,boolean isEx){
		// 名前のデコード
		Integer[] dec_name = decValue(name);
		int index = dec_name[0];
		int part = dec_name[1];
		int ex = 0;
		if(isEx)ex = 1;
		// 基本DEF
		int base_def = (int)data[index][1][part*2 + ex];
		// plusによるDEF増加
		int plus_def = 3*plus;
		// +10以上のDEF増加
		if(plus>9)
			for(int i=0;i<plus-9;i++)
				plus_def += i;
		// 合計
		int def = base_def + plus_def;
		
		return def;
	}
	/**
	 * SELECT用のValueを作成します。
	 * @param index
	 * @param part
	 * @return string
	 */
	private static String encValue(Integer index,Integer part){
		return index.toString()+part.toString();
	}
	/*==============================================================================================
	 * public 関数
	 *==============================================================================================/
	/**
	 * SELECT用のValueをデコードします。
	 * @param name
	 * @return [index,part]
	 */
	public static Integer[] decValue(int name){
		Integer[] result = new Integer[2];
		result[0] = name/10;
		result[1] = name%10;
		return result;
	}
	/**
	 * 装備の名前の配列を返します。
	 * @param part 0:兜 1:鎧 2:手 3:腰 4:足
	 * @param job
	 * @return names
	 */
	public static String[][] getNames(int part,Integer job){
		String[][] str = new String[data.length][2];
		int size = 0;
		int jobnum = (1<<job);
		for(int i=0;i<data.length;i++)
			if((new Double(data[i][0][1]).intValue()&jobnum)!=0){
				str[size][0] = series[i] + getPartName(part,data[i][0][0]);
				str[size][1] = encValue(i,part);
				size++;
			}
		String[][] names = new String[size][2];
		for(int i=0;i<size;i++){
			names[i] = str[i];
		}
		return names;
	}
	/**
	 * DEFを返します。
	 * @param name
	 * @param plus
	 * @return def
	 */
	public static Integer getDef(int name,int plus){
		return calcDef(name,plus,false);
	}
	/**
	 * EXのDEFを返します。
	 * @param name
	 * @param plus
	 * @return def
	 */
	public static Integer getExDef(int name,int plus){
		return calcDef(name,plus,true);
	}
}
